package main
import(
	"fmt"
	"strconv"
)
func main(){
//基本数据类型转String
//方法一
var num1 int = 99
var num2 float64 = 23.456
var str string
var myChar byte = 'h'
var b bool = true
str = fmt.Sprintf("%d",num1)
fmt.Printf("str type %T str=%q\n",str,str)
str = fmt.Sprintf("%f",num2)
fmt.Printf("str type %T str=%q\n",str,str)
str = fmt.Sprintf("%t",b)
fmt.Printf("str type %T str=%q\n",str,str)
str = fmt.Sprintf("%c",myChar)
fmt.Printf("str type %T str=%q\n",str,str)

//方法二
var num3 int = 99
var num4 float64 = 23.456
var b1 bool = true
str = strconv.FormatInt(int64(num3),10)
fmt.Printf("str type %T str=%q\n",str,str)
str = strconv.FormatFloat(num4,'f',10,64)
fmt.Printf("str type %T str=%q\n",str,str)
str = strconv.FormatBool(b1)
fmt.Printf("str type %T str=%q\n",str,str)

//
var num5 int =4567
str = strconv.Itoa(num5)
fmt.Printf("str type %T str=%q\n",str,str)
}